@echo off
chcp 65001 > nul
echo ========================================
echo 服务状态检查
echo ========================================
echo.

set ALL_OK=1

echo 【1】Gateway (8080)
curl -s http://localhost:8080/actuator/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
) else (
    echo    ❌ 未启动或无响应
    set ALL_OK=0
)
echo.

echo 【2】Knowledge Service (8087) ⭐
curl -s http://localhost:8087/api/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
    echo    查看详情: http://localhost:8087/api/info
) else (
    echo    ❌ 未启动或无响应
    set ALL_OK=0
)
echo.

echo 【3】LLM Service (8084)
curl -s http://localhost:8084/actuator/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
) else (
    echo    ❌ 未启动或无响应
    set ALL_OK=0
)
echo.

echo 【4】Code Completion (8081)
curl -s http://localhost:8081/actuator/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
) else (
    echo    ❌ 未启动或无响应
    set ALL_OK=0
)
echo.

echo 【5】Code Generation (8082)
curl -s http://localhost:8082/actuator/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
) else (
    echo    ❌ 未启动或无响应
    set ALL_OK=0
)
echo.

echo 【6】Data Service (8083) - 可选
curl -s http://localhost:8083/actuator/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
) else (
    echo    ⚠️  未启动（可选服务）
)
echo.

echo 【7】Build Service (8086) - 可选
curl -s http://localhost:8086/actuator/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
) else (
    echo    ⚠️  未启动（可选服务）
)
echo.

echo 【8】Agent Service (8088) - 可选
curl -s http://localhost:8088/actuator/health > nul 2>&1
if %errorlevel% equ 0 (
    echo    ✓ 运行正常
) else (
    echo    ⚠️  未启动（可选服务）
)
echo.

echo ========================================
if %ALL_OK% equ 1 (
    echo ✓ 核心服务全部正常！
    echo.
    echo 📝 下一步:
    echo    1. 扫描OpenHarmony代码: scan-ohcode.bat
    echo    2. 在VS Code中测试插件功能
) else (
    echo ❌ 部分核心服务未启动
    echo.
    echo 💡 启动缺失的服务:
    echo    start-all-with-knowledge.bat
)
echo ========================================
echo.

pause

